//app.js
App({
  onLaunch: function () {
    
    // // 展示本地存储能力
    // var logs = wx.getStorageSync('logs') || []
    // logs.unshift(Date.now())
    // wx.setStorageSync('logs', logs)
    var that = this;
  

    // 获取用户信息
    wx.getSetting({
      success: res => {
        if (res.authSetting['scope.userInfo']) {
          // 已经授权，可以直接调用 getUserInfo 获取头像昵称，不会弹框
          wx.getUserInfo({
            success: res => {
              // 可以将 res 发送给后台解码出 unionId
              this.globalData.userInfo = res.userInfo
              console.log('获取用户登录态成功1！' + res.errMsg)
              console.log(res);
              // 由于 getUserInfo 是网络请求，可能会在 Page.onLoad 之后才返回
              // 所以此处加入 callback 以防止这种情况
              if (this.userInfoReadyCallback) {
                this.userInfoReadyCallback(res)
                console.log('获取用户登录态成功2！' + res.errMsg)
                console.log(res);
              }
            }
          })
        }
      }
    })
  },
  globalData: {
    userInfo: null,
    wxcode:null,
    islogin: false,
    timespan:null,
    key:"rongtongjygykidgarden",
    appType:"3",
    mobileType:1,
    appKey:null,
    zhiboUrl:null,
    schoolRole:null,
    serverUrl:'https://apps.beiguanhuai.com/jygynew/api/app_kidgarden/',
    serverQiNiuUrl:'https://apps.beiguanhuai.com/jygynew/UploadQn.Json',
    qiniurUrl:'http://img.beiguanhuai.com',
    serverFaceUrl: 'https://m.beiguanhuai.com/public/faceWechat.json',
    userId: null,
    schoolId:null,
    url:null,
    classid:null,
    classname:null,
    classlist:null,
    schoolName:null,
    photo:null,
    cardno:null,
    name:null,
    familyId:0
  }

 // serverFaceUrl: 'https://m.beiguanhuai.com/public/faceWechat.json',
  // appid:'wxeb63c5bd1b80e255',//appid需自己提供，此处的appid我随机编写
  // secret:'506228bc94bfe298eca93854fedd1098'
  //'https://apps.beiguanhuai.com/jygynew/api/app_kidgarden/'
  // serverUrl:'https://t.beiguanhuai.com/jygynew/api/app_parent/',
  // serverUrl:'http://app.beiguanhuai.com/rongtongjygy/api/app_parent/',
  // 'https://t.beiguanhuai.com/jygynew/api/app_teacher/',
})